package SV_PERMS_HOME;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.util.Set;
import java.io.*;
public class Fixed_02 {
    public class FilePosix{
        public static void main(String[] args) throws IOException {
            Path path = Paths.get(System.getProperty("user.home") + File.separator + "test.file");
            Set<PosixFilePermission> perms = Files.readAttributes(path,PosixFileAttributes.class).permissions();
            perms.add(PosixFilePermission.OWNER_WRITE);
            perms.add(PosixFilePermission.OWNER_READ);
            perms.add(PosixFilePermission.OWNER_EXECUTE);
            Files.setPosixFilePermissions(path, perms);
            if (!Files.exists(path)) Files.createFile(path);
        }
    }
}
